package com.xiaoma.controller;

import com.xiaoma.factorybean.HelloWorldServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author 程序猿DD
 * @version 1.0.0
 * @blog http://blog.didispace.com
 *
 */
@RestController
public class HelloController {

    @Autowired
    private HelloWorldServiceInterface helloWorldServiceInterface;
/*    @Autowired
    private DemoService service;*/

    @RequestMapping(path = "/api/hello", method = {RequestMethod.GET, RequestMethod.POST})
    public String hello(String order) throws InterruptedException {
        helloWorldServiceInterface.sayHello();
        Thread.sleep(500);
        return "success...";
    }

    public String index(ModelMap map) {
        map.addAttribute("host", "http://blog.didispace.com");
        return "index";
    }

}